﻿<%@ WebHandler Language="C#" Class="Product_Bill_AddEdit" %>

using System;
using System.Web;
using System.Web.SessionState;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;

public class Product_Bill_AddEdit : IHttpHandler, IRequiresSessionState{

    private string VerificationImgCode = "";
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";

        /* 管理员信息验证 */
        if (!Admins.IsLogin(true))
            Utils.ShowEnd(context, -2);
        
        ArrayList Shopping_Cart_List = new ArrayList();
        
        
        int Bill_Id = Convert.ToInt32(context.Request.Params["Bill_Id"].ToString().Trim());



        string Bill_User_Name = context.Request.Params["Bill_User_Name"].ToString().Trim();
        string Bill_User_Phone = context.Request.Params["Bill_User_Phone"].ToString().Trim();
        string Bill_User_Address = context.Request.Params["Bill_User_Address"].ToString().Trim();
        string Bill_SendShops = context.Request.Params["Bill_SendShops"].ToString().Trim();


        string Bill_Product_List = context.Request.Params["Bill_Product_List"].ToString().Trim();
        string Bill_Count_List = context.Request.Params["Bill_Count_List"].ToString().Trim();
        int item_lang = Convert.ToInt32(context.Request.Params["item_lang"].ToString().Trim());
        double Bill_Price = Convert.ToDouble(context.Request.Params["Bill_Price"].ToString().Trim());

        string Bill_Status = context.Request.Params["Bill_Status"].ToString().Trim();
        string Bill_Inquiry_Id = context.Request.Params["Bill_Inquiry_Id"].ToString().Trim();
        /* 数据完整性验证 */
        Verification verification = new Verification();

        Regex chr;
        chr = new Regex(verification.ValidatePhone);
        if (!chr.IsMatch(Bill_User_Phone))
            Utils.ShowEnd(context, -1);

        Bills bill = new Bills();
        int status = bill.AddEdit(Bill_Id, Bill_User_Name, Bill_User_Phone, Bill_User_Address, Bill_SendShops, Bill_Status, Bill_Product_List, Bill_Inquiry_Id, item_lang, Bill_Count_List, Bill_Price);
        Utils.ShowEnd(context, status+"\n ok");
        
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}